<?php

/**
 * Changes some front controller settings if and only if the request maps to
 * the 'modules' module.
 *
 * @author     Mon Zafra <monzee at gmail>
 * @copyright  (c)2009 Mon Zafra
 * @category   Mz
 * @package    modules
 * @subpackage crud
 * @license    http://mz-project.googlecode.com/svn/trunk/LICENSE    MIT License
 * @version    SVN: $Id: Init.php 48 2009-05-29 11:03:25Z monzee $
 * @deprecated since r29
 */
class Modules_Plugin_Init extends Zend_Controller_Plugin_Abstract
{
    protected $_bootstrap;

    /**
     * constructor
     *
     * @param ArrayObject $appBootstrap The return value of the Modules
     *                                  resource plugin
     */
    public function __construct($appBootstrap)
    {
        $this->_bootstrap = $appBootstrap;
    }

    /**
     * Do custom params if the current module == 'modules'
     *
     * @param Zend_Controller_Request_Abstract $req
     * @return void
     */
    public function routeShutdown(Zend_Controller_Request_Abstract $req)
    {
        if ('modules' != $req->getModuleName()) {
            return;
        }
        $front = $this->_bootstrap->getResource('frontcontroller');
        $front->getDispatcher()->setParam('useDefaultControllerAlways', true);
    }
}
